home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Disksavers / DiskSalv2 / Install < prev    next >
Text File  |  1996-09-26  |  14KB  |  377 lines

  1. ;======================================================================
  2. ;
  3. ; DiskSalv general installer -- $VER: Install 11.5 (11.4.94)
  4. ;
  5. ; 11.5    Added updates for DiskSalv V11.30 distribution, mainly support
  6. ;    for the additional locale files.
  7. ; 11.4    Simple updates for DiskSalv V11.28
  8. ;    Fixed the install-locale-from-archive routine
  9. ; 11.3    Added better checks for the existance of the locales archive
  10. ;
  11. ;======================================================================
  12. ;
  13. ; Some basic strings
  14.  
  15. (set #disksalv-install 
  16.      (cat "\nInstall DiskSalv\n"
  17.           "\nYou may install the DiskSalv program and related "
  18.           "files in the directory of your choice.  Proceed?"))
  19.  
  20. (set #disksalv-install-help
  21.      (cat "\nThis section lets you choose in which drawer or on "
  22.           "which disk the DiskSalv program will be installed."
  23.           "\n\nIf you choose to proceed, you will be asked where you "
  24.           "want the DiskSalv files placed.  If you choose "
  25.           "to skip this part, you will go to the portion of the "
  26.           "installation that processes language installations".))
  27.  
  28. (set #which-disk
  29.      "In which disk or drawer should DiskSalv be installed?")
  30.  
  31. (set #any-locale
  32.      (cat "\nInstall DiskSalv Localizations\n"
  33.           "\nYou may install the DiskSalv locale files for various "
  34.           "languages in the LOCALE: directory.  Proceed?"))
  35.  
  36. (set #any-locale-help
  37.      (cat "\nDiskSalv can be operated in different languages."
  38.           "\n\nIf you choose to proceed, you will be asked to "
  39.           "select the translations you want available on your"
  40.       "system."))
  41.  
  42. (set #which-language "\nWhich catalogs should be installed?")
  43.  
  44. (set #which-language-help
  45.      (cat "\nDiskSalv can be operated in many different "
  46.          "languages. One file will be copied to your "
  47.          "hard drive for each language supported.\n\n"
  48.          "To reduce the amount of space consumed by the "
  49.          "language files, you can select only the "
  50.          "files of specific languages to be copied.\n\n"
  51.          "Check the boxes of the languages you wish "
  52.          "to have available on your system.\n\n"
  53.          @askoptions-help))
  54.  
  55. (set #docs-install
  56.      (cat "\nInstall DiskSalv Documentation\n"
  57.           "\nA small manual for DiskSalv can be installed in the"
  58.           "\ndirectory of your choice.  Proceed?"))
  59.  
  60. (set #which-docs "\nWhich manuals should be installed?")
  61.  
  62. (set #docs-install-help
  63.      (cat "\nThis section lets you choose in which drawer or on "
  64.           "which disk the DiskSalv documentation will be installed."
  65.           "\n\nIf you choose to proceed, you will be asked where you "
  66.           "want the DiskSalv documents placed.  If you choose "
  67.           "to skip this part, installation is complete."))
  68.  
  69. (set #docs-where
  70.      (cat "\nIn which disk or drawer should DiskSalv documentation "
  71.           "be installed?"))
  72.  
  73. (set #system-catalog "locale:catalogs"
  74.      #subdir-catalog "locale/catalogs"
  75.      #subdir-docs    "locale/docs"
  76.      #dscatname      "DiskSalv.catalog"
  77.      #dsdocname      "DiskSalv.doc"
  78.      #tmp-dir        "T:DiskSalv")
  79.  
  80. (set #get-dearchiver
  81.      (cat "\nPlease specify the file name of a de-archiver "
  82.           "program for \"LHA\"-type files."))
  83.  
  84. ;======================================================================
  85. ;
  86. ; This function asks about the language, and sets the global "lang" to
  87. ; the language bit mask returned by the request.
  88. ;
  89.  
  90. (procedure ASKLANGUAGE
  91.    (if (= askmode 0)
  92.        ((set lang (askoptions (prompt #which-language)
  93.                               (help #which-language-help)
  94.                               (choices "dansk"
  95.                                        "deutsch"
  96.                                        "english"
  97.                        "español"
  98.                                        "français"
  99.                                        "italiano"
  100.                                        "norsk"
  101.                                        "suomi"
  102.                                        "svenska")))
  103.          (if (IN lang 2) (set doclang 1))
  104.          (if (IN lang 7) (set doclang (+ doclang 2))))
  105.      (if (= doclang 0)
  106.          ((set doclang (askoptions (prompt #which-docs)
  107.                        (help #which-language-help)
  108.                                    (choices "english" 
  109.                             "español"
  110.                                             "français"
  111.                                             "svenska")))))))
  112.  
  113. ;======================================================================
  114. ;
  115. ; This function finds a de-archiver in the user's system, resulting to
  116. ; a panic "ask-the-user" if none can be found.
  117. ;
  118.  
  119. (procedure FINDARCPROG
  120.    (set n 0)
  121.    (while (set test (select n "lz"
  122.                               "lha"
  123.                               ""))
  124.       (if (not (run (cat "which " test)))
  125.           (set arcprog test))
  126.       (set n (+ n 1)))
  127.  
  128.    (if (= arcprog "")
  129.        (set arcprog (askfile (prompt #get-dearchiver)
  130.                              (help @askfile-help)
  131.                              (default "C:"))))
  132. )
  133.  
  134. ;======================================================================
  135. ;
  136. ; This function gets the locale file information.  We mark the occasion
  137. ; with bit 0 set for the availability of the subdirectory, bit 1 set 
  138. ; for the availability of the archive file. 
  139. ;
  140.  
  141. (procedure ANYLOCALE
  142.    (set localecode 0)
  143.    (if (exists locale-catalogs)
  144.        (set localecode 1))
  145.    (if (exists locale-archive)
  146.        (set localecode (+ localecode 2)))
  147.    localecode)
  148.  
  149. ;======================================================================
  150. ;
  151. ; This function transfers a locale file from the appropriate archive
  152. ; entry to the proper LOCALE:Catalogs subdirectory.
  153. ;
  154.  
  155. (procedure DOCATARCS
  156.    (if (= arcprog "") (FINDARCPROG))
  157.    (if (<> arcprog "")
  158.        ((working "\nDe-archiving selected catalogs\n")
  159.     (makedir #tmp-dir)
  160.         (set arcsfiles (cat #subdir-catalog "/(" arclst ")/#?"))
  161.         (set dearc-com (cat arcprog " >NIL: <NIL: e " locale-archive " "
  162.                             arcsfiles))
  163.         (set script (tackon #tmp-dir "de-archive-script"))
  164.         (textfile (dest script)
  165.                   (append (cat "cd " #tmp-dir "\n" dearc-com "\n")))
  166.  
  167.         (execute script)
  168.         (copyfiles (source (tackon #tmp-dir #subdir-catalog))
  169.                    (dest   #system-catalog)
  170.                    (pattern "#?"))
  171.         (run (cat "Delete >NIL: <NIL: " #tmp-dir " all")))))
  172.  
  173. ;======================================================================
  174. ;
  175. ; This function transfers the locale files from the appropriate 
  176. ; existing subdirectories (in "sublst")  to the corresponding
  177. ; LOCALE:Catalogs subdirectories.
  178. ;
  179.  
  180. (procedure DOCATSUBS
  181.    (copyfiles (source locale-catalogs)
  182.               (dest   #system-catalog)
  183.               (pattern (cat "(" sublst ")"))))
  184.  
  185. ;======================================================================
  186. ;
  187. ; This function merges the new and old locale files if they both exist.
  188. ;
  189.  
  190. (procedure MERGELOCALES
  191.    (if (not (exists locale-archive))
  192.        (set locale-archive locale-update)
  193.        (if (exists locale-update)
  194.            ((if (= arcprog "") (FINDARCPROG))
  195.             (if (<> arcprog "")
  196.                 ((working "\nUpdating Locale Archives...\n")
  197.                  (makedir #tmp-dir)
  198.                  (set dearc-com (cat arcprog " >NIL: <NIL: e " locale-update))
  199.                  (set rearc-com (cat arcprog " >NIL: <NIL: u " locale-archive
  200.                                              " locale/#?"))
  201.                  (set script (tackon #tmp-dir "re-archive-script"))
  202.                  (textfile (dest script)
  203.                             (append (cat "cd " #tmp-dir "\n" dearc-com "\n" rearc-com "\n")))
  204.                  (execute script)
  205. ;                 (run (cat "Delete >NIL: <NIL: " #tmp-dir " all"))
  206. ))))))
  207.  
  208. ;======================================================================
  209. ;
  210. ; This function selects the language to be installed.
  211. ;
  212.  
  213. (procedure DOLOCALE
  214.    (if (not (exists #system-catalog))
  215.        (makedir #system-catalog))
  216.    (set n      0
  217.         sublst ""
  218.         arclst "")
  219.    (while (set language (select n "dansk"
  220.                                   "deutsch"
  221.                                   "english"
  222.                                   "français"
  223.                                   "italiano"
  224.                                   "norsk"
  225.                                   "suomi"
  226.                                   "svenska"
  227.                                   ""))
  228.      (if (AND (IN lang n) (<> n 2))
  229.         (if (exists (tackon locale-catalogs (tackon language #dscatname)))
  230.             (if (= sublst "") (set sublst language) (set sublst (cat sublst "|" language)))
  231.             (if (= arclst "") (set arclst language) (set arclst (cat arclst "|" language)))))
  232.      (set n (+ n 1)))
  233.  
  234.    (if (AND (IN localecode 0) (<> sublst "")) (DOCATSUBS))
  235.    (if (AND (IN localecode 1) (<> arclst "")) (DOCATARCS)))
  236.  
  237. ;======================================================================
  238. ;
  239. ; This function gets the locale file information.  We mark the occasion
  240. ; with bit 0 set for the availability of the subdirectory, bit 1 set 
  241. ; for the availability of the archive file. 
  242. ;
  243.  
  244. (procedure ANYDOCS
  245.    (set docscode 0)
  246.    (if (exists locale-docs)
  247.        (set docscode 1))
  248.    (if (exists locale-archive)
  249.        (set docscode (+ docscode 2)))
  250.    docscode)
  251.  
  252. ;======================================================================
  253. ;
  254. ; This function transfers a doc file from the appropriate archive
  255. ; entry to the selected documentation subdirectory.
  256. ;
  257.  
  258. (procedure DODOCARCS
  259.    (if (= arcprog "") (FINDARCPROG))
  260.    (if (<> arcprog "")
  261.        ((working "\nDe-archiving selected docs files\n")
  262.     (makedir #tmp-dir)
  263.         (set arcsfiles (cat "(" #subdir-docs "/(" arclst ")/#?|" 
  264.                                 #subdir-docs ".info)"))
  265.         (set dearc-com (cat arcprog " >NIL: <NIL: e " locale-archive " "
  266.                             arcsfiles))
  267.         (set script (tackon #tmp-dir "de-archive-script"))
  268.         (textfile (dest script)
  269.                   (append (cat "cd " #tmp-dir "\n" dearc-com "\n")))
  270.         (execute script)
  271.         (copyfiles (source (tackon #tmp-dir #subdir-docs))
  272.                    (dest   docoutputdir)
  273.                    (pattern "#?"))
  274.         (run (cat "Delete >NIL: <NIL: " #tmp-dir " all")))))
  275.  
  276. ;======================================================================
  277. ;
  278. ; This function transfers the docs files from the appropriate 
  279. ; existing subdirectories (in "sublst")  to the selected
  280. ; directory.
  281. ;
  282.  
  283. (procedure DODOCSUBS
  284.    (copyfiles (source locale-docs)
  285.               (dest   docoutputdir)
  286.               (pattern (cat "(" sublst ")"))))
  287.  
  288. ;======================================================================
  289. ;
  290. ; This function manages document installation.  It should automatically
  291. ; install any docs based on the requested localizations.  If none match,
  292. ; the user should be given a new choice of languages.
  293. ;
  294.  
  295. (procedure DODOCS
  296.    (set docoutputdir 
  297.         (tackon (askdir (prompt  #docs-where)
  298.                 (help    @askdir-help)
  299.                 (default @default-dest))
  300.                 "DiskSalv_Docs"))
  301.    (set n      0
  302.         sublst ""
  303.         arclst "")
  304.    (while (set language (select n "english"
  305.                   "français"
  306.                                   "svenska"
  307.                                   ""))
  308.      (if (IN doclang n)
  309.         ((set testfile (tackon locale-docs (tackon language #dsdocname)))
  310.          (if (exists testfile)
  311.              (if (= sublst "") (set sublst language) (set sublst (cat sublst "|" language "|"
  312.                                                                       language ".info")))
  313.              (if (= arclst "") (set arclst language) (set arclst (cat arclst "|" language "|"
  314.                                                                       language ".info"))))))
  315.      (set n (+ n 1)))
  316.    (if (AND (IN docscode 0) (<> sublst "")) (DODOCSUBS))
  317.    (if (AND (IN docscode 1) (<> arclst "")) (DODOCARCS)))
  318.  
  319. ;======================================================================
  320. ;
  321. ; The main program
  322.  
  323. (set inputdir          (pathonly @icon))
  324. (set locale-archive    (tackon inputdir "DSLocale.lha")
  325.      locale-update     (tackon inputdir "DSLocale11_30.lha")
  326.      locale-catalogs   (tackon inputdir #subdir-catalog)
  327.      locale-docs       (tackon inputdir #subdir-docs)
  328.      arcprog           ""
  329.      doclang           0
  330.      @default-dest     "SYS:Tools")
  331.  
  332. ; First, install the DiskSalv program proper
  333.  
  334. (if (askbool (prompt #disksalv-install)
  335.              (help #disksalv-install-help)
  336.              (choices "Yes" "Skip This Part")
  337.              (default 1))
  338.     ((set outputdir 
  339.           (askdir (prompt  #which-disk)
  340.           (help    @askdir-help)
  341.           (default @default-dest)))
  342.      (set @default-dest outputdir)
  343.      (copyfiles (source inputdir)
  344.                 (dest outputdir)
  345.                 (pattern "DiskSalv")
  346.                 (files)
  347.                 (infos))
  348.      (tooltype  (dest (tackon outputdir "DiskSalv"))
  349.                 (noposition)))
  350.     (set @default-dest ""))
  351.  
  352. ; Next, consider the locales.  Ask the user for a selection
  353. ; of catalogs, then call the catalog installer function. 
  354.  
  355. (MERGELOCALES)
  356.  
  357. (if (ANYLOCALE)
  358.     (if (askbool (prompt #any-locale)
  359.                  (help #any-locale-help)
  360.                  (choices "Yes" "Skip This Part")
  361.                  (default 1))
  362.                   
  363.         ((set askmode 0)
  364.          (ASKLANGUAGE)
  365.          (DOLOCALE))))
  366.  
  367. (if (ANYDOCS)
  368.     (if (askbool (prompt #docs-install)
  369.              (help #docs-install-help)
  370.                  (choices "Yes" "Skip This Part")
  371.                  (default 1))
  372.         ((set askmode 1)
  373.          (ASKLANGUAGE)
  374.          (DODOCS))))
  375.  
  376.  
  377.